/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pe.gov.mtc.dgac.licencias.bean;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author German
 */
@Entity
@Table(name = "HABILITACION")
@NamedQueries({@NamedQuery(name = "HabilitacionTO.findByCodHabilitacion", query = "SELECT h FROM HabilitacionTO h WHERE h.codHabilitacion = :codHabilitacion"), @NamedQuery(name = "HabilitacionTO.findByDescripcion", query = "SELECT h FROM HabilitacionTO h WHERE h.descripcion = :descripcion")})
public class HabilitacionTO implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "COD_HABILITACION", nullable = false)
    private Long codHabilitacion;
    @Column(name = "DESCRIPCION", nullable = false)
    private String descripcion;
    @ManyToMany(mappedBy = "codHabilitacionCollection")
    private Collection<EvaluacionhabilitacionTO> codEvalHabCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "habilitacionTO")
    private Collection<ClientelicenciahabTO> clientelicenciahabTOCollection;
    @JoinColumn(name = "COD_TIPO_AERONAVE", referencedColumnName = "COD_TIPO_AERONAVE")
    @ManyToOne
    private TipoaeronaveTO codTipoAeronave;

    public HabilitacionTO() {
    }

    public HabilitacionTO(Long codHabilitacion) {
        this.codHabilitacion = codHabilitacion;
    }

    public HabilitacionTO(Long codHabilitacion, String descripcion) {
        this.codHabilitacion = codHabilitacion;
        this.descripcion = descripcion;
    }

    public Long getCodHabilitacion() {
        return codHabilitacion;
    }

    public void setCodHabilitacion(Long codHabilitacion) {
        this.codHabilitacion = codHabilitacion;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Collection<EvaluacionhabilitacionTO> getCodEvalHabCollection() {
        return codEvalHabCollection;
    }

    public void setCodEvalHabCollection(Collection<EvaluacionhabilitacionTO> codEvalHabCollection) {
        this.codEvalHabCollection = codEvalHabCollection;
    }

    public Collection<ClientelicenciahabTO> getClientelicenciahabTOCollection() {
        return clientelicenciahabTOCollection;
    }

    public void setClientelicenciahabTOCollection(Collection<ClientelicenciahabTO> clientelicenciahabTOCollection) {
        this.clientelicenciahabTOCollection = clientelicenciahabTOCollection;
    }

    public TipoaeronaveTO getCodTipoAeronave() {
        return codTipoAeronave;
    }

    public void setCodTipoAeronave(TipoaeronaveTO codTipoAeronave) {
        this.codTipoAeronave = codTipoAeronave;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codHabilitacion != null ? codHabilitacion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HabilitacionTO)) {
            return false;
        }
        HabilitacionTO other = (HabilitacionTO) object;
        if ((this.codHabilitacion == null && other.codHabilitacion != null) || (this.codHabilitacion != null && !this.codHabilitacion.equals(other.codHabilitacion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.dgac.licencias.to.HabilitacionTO[codHabilitacion=" + codHabilitacion + "]";
    }

}
